<?php
@ini_set('session.use_trans_sid', 1);
session_start();
include("lettering.php");

if(isset($_SESSION['name'])){
    
$number =  $_SESSION['actualLetterNumber'];
echo "<div id=\"letter\"><table class=\"letterstable\"> <tr>";
for ( $i=0; $i < 3; $i++ )      {
echo "<th><form name=\"myletter".$i."\"  id=\"myletter".$i."\"  action=\"index.php\" method=\"post\">";
echo "<input type=\"hidden\" name=\"myletter\" value=\"$i\">";
echo "<input class=\"myletters\" name=\"myletterchar\" id=\"myletterchar".$i."\" type=\"button\" ";
if (($i < 2)||($_SESSION['numButtons']==5)) { echo "title=\""; echo $title[7]; echo"\" ";}
else {echo "title=\""; echo $title[8]; echo"\" ";}
echo " onclick=\"mylettersubmit($i)\" size= \"3\" value=\"";echo $_SESSION['charArray'][$i][$number];echo "\">";
echo "</form></div></th>";
}

echo "</tr><div class= \"mystars\">
<tr><th>"; 
for ($i=0; $i < $_SESSION['numLetters']; $i++) {if ($i == $number) echo "<font color=\"#FF0000\">"; echo $_SESSION['charArray'][0][$i]." ";
if ($i == $number) echo "</font>";}
echo "</th><th>"; 
for ($i=0; $i < $_SESSION['numLetters']; $i++) {if ($i == $number) echo "<font color=\"#FF0000\">"; echo $_SESSION['charArray'][1][$i]." ";
if ($i == $number) echo "</font>";}
echo "</th><th>"; 
for ($i=0; $i < $_SESSION['numLetters']; $i++) {if ($i == $number) echo "<font color=\"#FF0000\">"; echo $_SESSION['charArray'][2][$i]." ";
if ($i == $number) echo "</font>";}; echo "</th></tr>";

if ($_SESSION['numButtons']==5)	{ // letter buttons for head mice variant
echo "<tr>";

for ( $i=3; $i < 5; $i++ )      {
echo "<th><form name=\"myletter".$i."\"  id=\"myletter".$i."\"  action=\"index.php\" method=\"post\">";
echo "<input type=\"hidden\" name=\"myletter\" value=\"$i\">";
echo "<input class=\"myletters\" name=\"myletterchar\" id=\"myletterchar".$i."\" type=\"button\" ";
echo "title=\"";echo $title[7]; echo "\" ";
echo " onclick=\"mylettersubmit($i)\" size= \"3\" value=\"";echo $_SESSION['charArray'][$i][$number];echo "\">";
echo "</form></div></th>";
if ($i==3) echo "<th></th>";
}

echo "</tr><div class= \"mystars\">
<tr><th>"; 
for ($i=0; $i < $_SESSION['numLetters']; $i++) {if ($i == $number) echo "<font color=\"#FF0000\">"; echo $_SESSION['charArray'][3][$i]." ";
if ($i == $number) echo "</font>";}
echo "</th><th></th><th>"; 
for ($i=0; $i < $_SESSION['numLetters']; $i++) {if ($i == $number) echo "<font color=\"#FF0000\">"; echo $_SESSION['charArray'][4][$i]." ";
if ($i == $number) echo "</font>";}
echo "</th><tr>"; 

    
echo "<tr><th><form name=\"myletter6\"  id=\"myletter6\"  action=\"index.php\" method=\"post\">";
echo "<input type=\"hidden\" name=\"myletter\" value=\"6\">";
echo "<input class=\"myletters\" name=\"myletterchar\" id=\"myletterchar6\" type=\"button\" ";
echo "title=\"";echo $title[12]; echo "\" ";
echo " onclick=\"mylettersubmit(6)\" size= \"3\" value=\"D\">";
echo "</form></th><th>";

echo "<form name=\"myletter7\"  id=\"myletter7\"  action=\"index.php\" method=\"post\">";
echo "<input type=\"hidden\" name=\"myletter\" value=\"7\">";
echo "<input class=\"myletters\" name=\"myletterchar\" id=\"myletterchar7\" type=\"button\" ";
echo "title=\"";echo $title[13]; echo "\" ";
echo " onclick=\"mylettersubmit(7)\" size= \"3\" value=\"S\">";
echo "</form></th>";

echo "<th><form name=\"myletter8\"  id=\"myletter8\"  action=\"index.php\" method=\"post\">";
echo "<input type=\"hidden\" name=\"myletter\" value=\"8\">";
echo "<input class=\"myletters\" name=\"myletterchar\" id=\"myletterchar8\" type=\"button\" ";
echo "title=\"";echo $title[14]; echo "\" ";
echo " onclick=\"mylettersubmit(8)\" size= \"3\" value=\"N\">";
echo "</form></th></tr>";
echo    "</table></div>";
}
 $_SESSION['actualLetterNumber']= $_SESSION['actualLetterNumber']+1;
if ($_SESSION['actualLetterNumber']== $_SESSION['numLetters']) $_SESSION['actualLetterNumber']=0;
}

?>